package cn.wolfcode.shop.goodsserver.web.controller.rpc;

import cn.wolfcode.shop.goodsapi.domain.Good;
import cn.wolfcode.shop.goodsapi.feign.GoodsFeignApi;
import cn.wolfcode.shop.goodsserver.mapper.GoodsMapper;
import cn.wolfcode.shop.redis.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.cache.CacheProperties;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class GoodsFeiClient implements GoodsFeignApi {

    @Autowired
    private GoodsMapper goodsMapper;

    @Autowired
    private RedisService redisService;



    @Override
    public List<Good> findByIds(List<Long> ids) {
        List<Good> goods = goodsMapper.findByIds(ids);

        return goods;
    }

    @Override
    public Good findById(Long goodId) {
        Good good = goodsMapper.findById(goodId);
        //Good good = redisService.get();
        return good;
    }

    @Override
    public int updataById(Long goodId) {
        return goodsMapper.updataById(goodId);
    }
}
